import { axios ,axios2}  from '../utils/request'




//post
export function postAction(url,parameter) {
  return axios({
    url: url,
    method:'post' ,
    headers: {
      'Content-Type': 'application/json',//设置请求头请求格式为JSON
    },
    data: parameter
  })
}

//post method= {post | put}
export function httpAction(url,parameter,method) {
  return axios({
    url: url,
    method:method ,
    data: parameter
  })
}

//put
export function putAction(url,parameter) {
  return axios({
    url: url,
    method:'put',
    data: parameter
  })
}

//get
export function getAction(url,parameter) {
  return axios({
    method: 'get',
    url: url+'?openid='+parameter,
    headers: {
      'Content-Type': 'application/json',

    }
  })
}
export function getWXConfigSignature(url,param) {
  return axios({
    method: 'get',
    url: url+'?url='+param,
      headers: {
          'Content-Type': 'application/json',

      }

  })
}
export function getComm(url,parameter) {
  return axios({
    method: 'get',
    url: url,
      headers: {
          'Content-Type': 'application/json',

      },
    params: parameter

  })
}
export function postComm(url,parameter) {
  return axios({
    method: 'post',
    url: url,
      headers: {
          'Content-Type': 'application/json',

      },
    data: parameter

  })
}

/**
 * 文件上传
 * @param url
 * @param parameter
 */
export function postUpload(url,parameter) {
  return axios2({
    method: 'post',
    url: url,
    data:parameter

  })
}

//deleteAction
export function deleteAction(url,parameter) {
  return axios({
    url: url,
    method: 'delete',
    params: parameter
  })
}
/**
 * 下载文件 用于excel导出
 * @param url
 * @param parameter
 * @returns {*}
 */
export function downFile(url,parameter){
  return axios({
    url: url,
    params: parameter,
    method:'get' ,
  })
}




